Accusoft.PdfXpress7.ActiveX
Merge Multiple PDFs into One PDF

PDF Xpress™ supports merging multiple source PDF documents into one target PDF document using the InsertPages method.

VB Example
Copy Code
'This code demonstrates merging multiple PDFs
On Error GoTo error
Dim pdfXpress1 As  New PdfXpress
pdfXpress1.Initialize
pdfxpress1.RaiseExceptions = True
Dim docpageList As New PageList
Dim docpageRange As New PageRange
docpageList.Add docpageRange
Dim insertOpts As InsertPageOptions
insertOpts.PageList = docpageList
docpageRange.StartPageNumber = 0
docpageRange.pageCount = 1
Dim numDoc As Integer
 numDoc = 4
Dim so As New SaveOptions
so.FileName = "C:\merged.pdf"
Dim doc_merge As New PdfDocument
doc_merge. SetParentControl pdfXpress1
doc_merge.NewDocument
Dim a As Integer
For a = 0 To pageCount - 1
         Dim doc_new As New PdfDocument
         doc_new.SetParentControl pdfxpress1
         doc_new. OpenDocument  "C:\split" + CStr(a) + ".pdf", ""
         insertOpts.SourceDocument = doc_new
         insertOpts.InsertAtPageNumber = a
          doc_new.InsertPages insertOpts
Next a         
doc_new.SaveDocument so
.
.
.
GoTo finish
error:
MsgBox Err.Description
finish:

Set document = Nothing
pdfxpress1.Terminate
Set pdfxpress1= Nothing

 

See Also

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback